<template>
	<view class="myLike">
		<view v-for="(item,index) in likeLis" :key="index" class="li" @click="toArticle(item.objectId)">
			<view class="agopages-img">
				<image :src="item.image" />
			</view>

			<view class="agopages-text">
				<p>{{ item.title }}</p>
				<text>{{ item.body }}</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				likeLis: [],

			}
		},
		methods: {
			getData() {
				uni.getStorageInfo({
					success: (res) => {
						// console.log(res.keys)
						for (let i = 0; i < res.keys.length; i++) {
							// console.log(uni.getStorageSync(res.keys[i]));
							this.likeLis.push(uni.getStorageSync(res.keys[i]));
						}

					}
				})

			},
			toArticle(id) {
				uni.navigateTo({
					url: `/pages/article/article?id=${id}`
				})
			},

		},
		mounted() {
			this.getData()
		},
		
		
	}
</script>

<style lang="scss" scoped>
	.li {
	  display: flex;
	  justify-content: space-between;
	  width: 93%;
	  height: 100px;
	  margin: 10px auto;
	  border-bottom: 1px solid #ccc;
	}
	
	.agopages-img {
	  width: 36%;
	  image {
	    width: 100%;
	    height: 80px;
	    border-radius: 15px;
	  }
	}
	
	.agopages-text {
	  width: 54%;
	
	  p {
	    overflow: hidden; /*内容超出后隐藏*/
	    text-overflow: ellipsis; /* 超出内容显示为省略号 */
	    white-space: nowrap; /* 文本不进行换行 */
	    padding-top: 5px;
	  }
	
	  text {
	    color: #ccc;
	    font-size: 13px;
	    display: -webkit-box;
	    -webkit-box-orient: vertical;
	    -webkit-line-clamp: 3;
	    overflow: hidden;
	    padding-top: 8px;
	  }
	}
</style>
